package com.lwx.web.lesson3;

import com.lwx.domain.User;
import com.lwx.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author draem
 * @create 2018-06-28 15:27
 */
@RestController
public class JpaController {

    @Autowired
    private UserService userService;

    @RequestMapping(value = "/user/{id}",method = RequestMethod.GET)
    public User getUserById(@PathVariable int id){

        User user =userService.getUserById(id);
        return user;

    }
}
